<?php
namespace app\admin\controller;
use think\Controller;
use think\Db;
class Index extends Common{
	public function index(){
		$admin_id = session('admin_id');
		$admin = db('admin')
		         ->field('admin_id,user_name,loginip,ipadress,logintime,loginnum')
		         ->where('admin_id',$admin_id)
		         ->find();
		$version = Db::query('SELECT VERSION() AS ver');         
		$config = [
            'url'             => $_SERVER['HTTP_HOST'],
            'document_root'   => $_SERVER['DOCUMENT_ROOT'],
            'server_os'       => PHP_OS,
            'server_port'     => $_SERVER['SERVER_PORT'],
            'server_ip'       => $_SERVER['SERVER_ADDR'],
            'server_soft'     => $_SERVER['SERVER_SOFTWARE'],
            'php_version'     => PHP_VERSION,
            'mysql_version'   => $version[0]['ver'],
		];
		$this->assign('admin',$admin);
		$this->assign('config',$config);
		return $this->fetch();
	}

	public function clear(){
		$dir = '../runtime';   
        rmdirs($dir);
        $this->success('清除成功','admin/index/index',0,1);
	}

}